﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zj.HttpCodeDemo.Domain.Core;

namespace Zj.HttpCodeDemo.Repository.Models.Mapping
{
    public class UserInfoMap
        : EntityTypeConfiguration<UserInfo>
    {
        public UserInfoMap()
        {
            //table
            this.ToTable("UserInfo", "dbo");

            //keys
            HasKey(t => t.Id);

            //properties
            this.Property(t => t.Id)
                .HasColumnName("Id")
                .IsRequired();

            this.Property(t => t.RealName)
                .HasColumnName("RealName")
                .HasMaxLength(16)
                .IsUnicode(true)
                .IsRequired();

            this.Property(t => t.Address)
                .HasColumnName("Address")
                .HasMaxLength(32)
                .IsUnicode(true)
                .IsRequired();

            this.Property(t => t.Age)
                .HasColumnName("Age")
                .IsRequired();

            //relations
        }
    }
}
